package com.qf.controller;


import com.qf.pojo.Car;
import com.qf.pojo.resp.BaseResult;
import com.qf.service.impl.CarServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
@CrossOrigin
@RestController
@RequestMapping("/car")
public class CarController {
    @Autowired

    CarServiceImpl carService;

    @RequestMapping("/findAllCar")
    public BaseResult findAllCar(){
        BaseResult baseResult = carService.findAllCar();
        return baseResult;

    }

    @RequestMapping("/addCar")
    public BaseResult addCar(Car car){
        BaseResult baseResult = carService.addCar(car);
        return baseResult;
    }

    @RequestMapping("/findCarById")
    public BaseResult findCarById(Integer p_id){
        BaseResult baseResult = carService.findCarById(p_id);
        return baseResult;
    }
}
